refactor: replace custom ILogger with Serilog + Microsoft.Extensions.Logging - #85
Merged
mcpolo99 merged 9 commits intoJul 2, 2026
Conversation
added 6 commits
June 11, 2026 20:34
Separate progress reporting (Progress, EndProgress, Finish) from logging into a new IProgressReporter interface. This is the first step toward replacing the custom ILogger with Microsoft.Extensions.Logging + Serilog. - Add IProgressReporter interface and NullProgressReporter - Remove Progress, EndProgress, Finish from ILogger and all implementations - Remove dead BeginModule/EndModule from NullLogger - Add ProgressReporter property to ConfuserParameters and ConfuserContext - Replace PackerLogger (full ILogger decorator) with PackerProgressReporter - Update all WithProgress call sites to use context.ProgressReporter - Fix MSBuildLogger.Finish bug (was setting HasError=false on failure) - Seal NullLogger class
Add Microsoft.Extensions.Logging.Abstractions to Confuser.Core (netstandard2.0 compatible) and a MelLoggerAdapter that bridges M.E.L ILogger to the internal Confuser.Core.ILogger interface. This allows callers to pass a standard M.E.L logger (backed by Serilog or any other provider) into ConfuserEngine without changing any internal code yet.
Wire up Serilog as the logging provider in the CLI via Microsoft.Extensions.Logging and MelLoggerAdapter. - Add Serilog, Serilog.Extensions.Logging, Serilog.Sinks.Console - Delete custom ConsoleLogger — Serilog handles all console output - Add --verbose (-v, -vv, -vvv) and --quiet (-q) CLI flags - Default: Information level; -q: Warning; -v: Debug; -vv+: Verbose
Wire up Serilog in the WPF GUI via a custom FlowDocumentSink that renders color-coded log output to the protection log panel. - Add Serilog and Serilog.Extensions.Logging to ConfuserEx - Create FlowDocumentSink — custom Serilog sink for WPF Paragraph - Remove ILogger from ProtectTabVM — now uses MelLoggerAdapter - ProtectTabVM keeps only IProgressReporter (progress bar + finish) - Delete ~40 lines of manual ILogger boilerplate
Full local CI script that replicates lint.yml, ci.yml, and test.yml: - lint: whitespace, style, and analyzer checks via dotnet format - build: dotnet build for SDK projects + MSBuild.exe for C++/CLI - test: discovers all *.Test.csproj, runs with coverage, summary - package: creates CLI, GUI, and combined zip archives Usage: ./scripts/local-ci.sh [lint|build|test|package|all]
…ging.ILogger (#64) Complete migration from the custom 13-method ILogger interface to the standard M.E.L ILogger abstraction across all projects. - Change ConfuserContext.Logger and ConfuserParameters.Logger to M.E.L ILogger - Convert all ~80 call sites: Debug→LogDebug, Info→LogInformation, Warn→LogWarning, Error→LogError, *Exception→swap parameter order - Rewrite MSBuildLogger as MSBuildMelLogger implementing M.E.L ILogger - Rewrite XUnitLogger implementing M.E.L ILogger + IProgressReporter - Remove MelLoggerAdapter (no longer needed — M.E.L is the native type) - Delete Confuser.Core.ILogger, NullLogger (replaced by M.E.L NullLogger) - Add test-results/ and coverage/ to .gitignore
Lint Results
|
Test Results
Cross-Framework Details
SummarySummary
CoverageConfuser.CLI - 60.6%
Confuser.Core - 25.9%
Confuser.DynCipher - 0.2%
Confuser.Protections - 4.9%
Confuser.Renamer - 42%
Confuser.UnitTest - 0%
|
added 3 commits
June 12, 2026 00:04
DoProtect used 'using var loggerFactory' which disposed the factory (and the Serilog logger via dispose:true) as soon as DoProtect returned. Since ConfuserEngine.Run executes asynchronously on a background thread, this disposed the logger before the protection actually used it, silently dropping log output mid-run. Move disposal into the ContinueWith continuation so the factory lives for the full protection lifetime.
Gui_ProtectSampleApp_ShowsSuccess intermittently failed at the Protect!
button lookup (~1 in 3 runs). Two root causes:
1. ByText("Protect!") ambiguously matched both the tab header and the
Protect! button (they share the caption), so the wrong element could
be clicked and the tab never actually got selected.
2. WPF virtualizes inactive tab content — the Protect! button does not
enter the UIA tree until the tab is selected AND rendered. The 5s
button-find timeout was too short under load.
Fix: match the tab by TabItem control type + name, Select() it and wait
for IsSelected, then find the button with a 15s timeout. 5/5 consecutive
full-suite runs now pass 3/3 (previously ~1/3 failed).
mcpolo99
marked this pull request as ready for review
July 2, 2026 19:05
mcpolo99
deleted the
64-replace-custom-ilogger-with-serilog-+-microsoftextensionslogging
branch
July 2, 2026 19:06
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the hand-rolled
Confuser.Core.ILoggerinterface (13 methods, 5 custom implementations) with the industry-standardMicrosoft.Extensions.Loggingabstraction backed by Serilog as the logging provider.Fixes #64
Changes
IProgressReporter— separates progress/finish from logging into its own interfaceMicrosoft.Extensions.Logging.Abstractions(netstandard2.0 compatible)ConsoleLogger, adds--verbose/--quietflagsFlowDocumentSinkreplaces 80+ lines of manual logger boilerplateLogDebug,LogInformation,LogWarning,LogError)Confuser.Core.ILogger,NullLogger,MelLoggerAdapter,PackerLogger,ConsoleLoggerMicrosoft.Extensions.Logging.ILoggerdirectlylocal-ci.sh— full local CI script mirroring GitHub Actions pipelineHasError = falseon failure (inverted logic)New CLI flags
Net result
Test plan
dotnet build Confuser2.sln -c Release— all C# projects compiledotnet test— 29/29 tests pass (CLI=2, CrossFramework=24, GUI=3)./scripts/local-ci.sh test— full pipeline green-vand-qflagsRelated